
import request from '@/utils/request'

// 查询列表
export function queryTableData(query:any) {
  return request({
    url: '/funConfig/cavity/group/list',
    method: 'get',
    params: query
  })
}

// 新增
export function addTableData(data:any) {
  return request({
    url: '/funConfig/cavity/group',
    method: 'post',
    data: data
  })
}

// 删除
export function deleteTableData(data:any) {
  return request({
    url: '/funConfig/cavity/group/remove',
    method: 'delete',
    params: data
  })
}

// 校验父设备 + 腔体组接口
export function checkFirst(query:any) {
  return request({
    url: '/funConfig/cavity/group/getInfo',
    method: 'get',
    params: query
  })
}

// 校验腔体列表
export function checkSecond(query:any) {
  return request({
    url: '/funConfig/cavity/group/getChamberList',
    method: 'get',
    params: query
  })
}

// 查询父设备
export function getTopEqp() {
  return request({
    url: '/parameter/getGroupMachineId',
    method: 'get'
  })
}

// 查询腔体列表
export function getChamberListchamberList(query:any) {
  return request({
    url: '/parameter/getMachineIdByMachineGroupIds',
    method: 'get',
    params: query
  })
}

// 重新计算EPR反应参数
export function RecalculateEPR() {
  return request({
    url: '/funConfig/information/timedTasksProcessingData',
    method: 'post'
  })
}

interface Column {
  headerName: string;
  field: string;
  width?: number;
  minWidth?: number;
  flex?: number;
  checkboxSelection?: boolean;
  filter?: string;
}

export const column: Column[] = [
  {
    headerName: "父设备", field: "topEqp", checkboxSelection: true, width: 150
  },
  {
    headerName: "父设备基准", field: "topEqpSt", width: 150
  },
  {
    headerName: "腔体组", field: "chamberGroup", width: 150
  },
  {
    headerName: "腔体列表", field: "chamberListchamberList", minWidth: 300, flex: 1
  },
  {
    headerName: "腔体组基准", field: "chamberGroupSt", width: 150
  },
  {
    headerName: "腔体数", field: "chamberTtl", width: 150
  }
]

column.forEach((item) => {
  item.filter = 'agMultiColumnFilter'
})